package service

import (
	"com.cyt.yunpay/app/dao"
	"com.cyt.yunpay/app/model"
)

var SercetConfig = new(sercetConfigService)

type sercetConfigService struct{}

// 创建密钥配置
func (s *sercetConfigService) CreateSercetConfig(r *model.AppSecretConfig) error {
	if _, err := dao.AppSecretConfig.Save(r); err != nil {
		return err
	}
	return nil
}

func (s *sercetConfigService) GetSercetConfigByAppId(app_id int) (*model.AppSecretConfig, error) {
	data, err := dao.AppSecretConfig.FindOne("app_id=?", app_id)
	if err != nil {
		return nil, err
	}
	return data, nil
}
